<!-- 
      occupation.html
      个人标答和选择职业 id=occupation
      type=1 职业 type=2 个人标签
      
      Created by tang on 2017-03-22.
      Copyright 2017 tang. All rights reserved.
 -->

<!doctype html>
<html>
<head>
	<meta charset="UTF-8">
	<title></title>
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<link href="../css/mui.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="../css/search.css" media="all" />
</head>

<body class="white">
	<div class="mui-content loading" id="vueMain">
		<ul class="mui-table-view sel-list">
			<template v-for="item in list">
				<li class="mui-table-view-cell mui-checkbox mui-right">
					<input name="city" type="checkbox" :value="item.id" v-bind:checked="check(item.id)" /> {{item.name}}
				</li>
			</template>
	        
	    </ul>
	</div>
<script src="../js/mui.js"></script>
<script src="../js/vue.min.js"></script>
<script src="../js/bexta.js"></script>
<script type="text/javascript">
	var apps, views;
	mui.init({
		beforeback:function(){
			var checkbox = document.querySelectorAll('input'),
				ckVal = [];
			mui.each(checkbox, function(){
				if( this.checked ){
					ckVal.push(this.value);
				}
			});
			mui.fire(views.opener(), 'callVal',{
				val:ckVal
			})
			return true;
		}
	});
	
	mui.plusReady(function () {
	    views = bexta.getWebview();
	    apps = new Vue({
	    		el:'#vueMain',
	    		data:{
	    			list:views.val,
	    			def:views.def
	    		},
	    		methods:{
	    			check:function(v){
	    				if(bexta.inArray(this.def, v)){
	    					return true;
	    				}
	    				return false;
	    			}
	    		},
	    		mounted:function(){
	    			document.querySelector('.loading').classList.add('loadRun');
	    			mui('.mui-table-view').on('tap', '.mui-checkbox', function(evt){
	    			})
//	    			mui('.mui-content').on('tap', '.mui-checkbox', function() {
//			   		mui.each(mui('input:checked'), function(){
//			   			this.checked = false;
//			   		});
//			   		this.checked = true;
//			   });
	    		}
	    })
	});
</script>
</body>
</html>